package com.jxbeidou.gateway.service.impl;

import com.jxbeidou.core.cache.CacheService;
import com.jxbeidou.core.constents.CacheConstants;
import com.jxbeidou.gateway.service.SecurityIgnoreUrlService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;

import java.util.Set;

/**
 * @program: jxbeidou-basic
 * @ClassName: SecurityIgnoreUrlServiceImpl
 * @description: 访问白名单
 * @author: 杜晓祥
 * @create: 2023-12-28 09:59
 * 版权所有：交信北斗(北京)信息科技有些公司
 */
@Slf4j
@Component
public class SecurityIgnoreUrlServiceImpl implements SecurityIgnoreUrlService {

    @Resource
    private CacheService cacheService;

    @Override
    public Set<String> loadIgnoreUrl() {
        Set<String> result = cacheService.sMembersByType(CacheConstants.SYS_LOGIN_IGNORE_LIST);
        if (ObjectUtils.isEmpty(result)) {
            return null;
        }
        return result;
    }
}
